﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ninject;
using Ninject.Modules;
using Demo.Business.EntityServices.Abstract;
using Demo.Business.EntityServices.Concrete;
using Demo.Business.ViewServices.Abstract;
using Demo.Business.ViewServices.Concrete;

namespace Demo.Business
{
    public class NinjectFactory 
    {
        private static IKernel kernel = new StandardKernel(new EntityServicesModuleLoader(), new ViewServicesModuleLoader());

        public static T Get<T>(params Ninject.Parameters.IParameter[] param)
        {
            return kernel.Get<T>(param);
        }
            
        public class EntityServicesModuleLoader : NinjectModule
        {
            public override void Load()
            {
                Bind<IPersonService>().To<PersonService>();
            }
        }
		
		public class ViewServicesModuleLoader : NinjectModule
        {
            public override void Load()
            {
                Bind<IHomeViewService>().To<HomeViewService>();
            }
        }

    }
}
